<?php if (count($languages) > 1) { ?>
<form action="<?php echo $action;?>" method="post" enctype="multipart/form-data" id="language_form">
    <div class="switcher">
        <?php foreach ($languages as $language) { ?>
        <?php if ($language['code'] == $language_code) { ?>
        <div class="selected"><a><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" />&nbsp;&nbsp;<?php echo $language['name']; ?></a></div>
        <?php } ?>
        <?php } ?>
        <div class="option">
            <?php foreach ($languages as $language) { ?>
            <a onclick="$('input[name=\'language_code\']').attr('value', '<?php echo $language['code']; ?>'); $('#language_form').submit();"><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" />&nbsp;&nbsp;<?php echo $language['name']; ?></a>
            <?php } ?>
        </div>
    </div>
    <div>
        <input type="hidden" name="language_code" value="" />
        <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
    </div>
</form>
<?php } ?>
